package com.java.performance.schema.Singleton;

import java.util.Enumeration;
import java.util.Vector;

/**
 * 
 * 设计模式：单例模式
 * 
 */
public class UserList {

	private static final UserList userList = new UserList();

	private Vector<String> v;

	private UserList() {
		v = new Vector<String>();
	}

	public static UserList getInstance() {
		return userList;
	}

	public void addUser(String name){
		if(null!=name){
			v.addElement(name);
		}
	}
	public void removeUser(String name){
		if(null!=name){
			v.removeElement(name);
		}
	}
	
	public Enumeration<String> getUserList(){
		return v.elements();
	}
	
	public int getUserCount(){
		return v.size();
	}
	
}
